<template>
    <div class="container">
       <p> {{name}}</p>
        <button @click="upName">change</button>
    </div>  
</template>
    
<script>
import { reactive, toRefs } from 'vue';
    
export default {
name:'App',
 setup() {
        //定义响应式数据
        const obj = reactive({
            name:'ls',
            age:18
        }) 
        // const {name}=obj
        const obj3=toRefs(obj)
        const upName=()=>{
            // obj.name='zs'
            obj3.name.value='ll'
        }
        return {
            ...obj3,
            upName
        }
    },
    }
    </script>
    
    <style>
    
    </style>